/* ==================================================================
* Copyright (c) 2024/11/15 SCNU LiuJunJie z-ken
* All rights reserved.
* fileName:	libs.hpp
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the xxx Group. and
* its contributors.
* 4. Neither the name of the Group nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Author,GROUP AND CONTRIBUTORS
* ===================================================================
* Author: LiuJunJie z-ken.
*/

#include <iostream>
using namespace std;
#include <bits/stdc++.h>

#ifndef LIBS_HPP
#define LIBS_HPP
#define NFA_SIZE 128 // NFA1和NFA2三维数组的初始化的行的尺寸
// NFA项目的行的个数，行为正则表达式的字符，实际上，最多共有128个字符，对应128行，所以128即可。
#define NFA_SIZE_RE_2 128
#define NFA_1_SIZE_ADD 64  // NFA1三维数组行数不足时候，需要一次扩容增加的行个数
#define NFA_2_SIZE_ADD 128 // NFA2三维数组行数不足时候，需要一次扩容增加的行个数
#define M_OUTPUT_LEN 24
#define SHOW_DFA 0 // 输出展示
#define SHOW_MINDFA 0
#define SHOW_NFA 0
#define SHOW_READFILE 0

#include <string>

#if !defined(LIB_HPP)
#define LIB_HPP

class LibUtil
{
public:
    static std::string trim(const std::string &str)
    {
        size_t end = str.find_last_not_of(' ');
        if (std::string::npos != end)
        {
            return str.substr(0, end + 1);
        }
        return "";
    }

    // 测试时刻使用的函数
    static void saveVectorString(vector<string> vs, string outputFilePath)
    {
        ofstream ofs(outputFilePath);
        for (int i = 0; i < vs.size(); i++)
        {
            ofs << "\"" << vs[i] << "\"";
            if (i != vs.size() - 1)
            {
                ofs << ",";
            }
        }
    }
};

#endif // LIB_HPP

#endif